// define(function(require, exports, module) {

  var React = require('react');
  var ReactDOM = require('react-dom');
  var Form = require('jsx!./form')
  var ValidateForm = require('jsx!./validate-form')
  var antd = require('antd');
  var { Button } = antd;

  var hdata = require('hy5b/auto/data')

  function App() {

    this.AppView = React.createClass({
      getInitialState() {
        return {
          interact: {}
        }
      },

      handleChange(data) {
        this.setState({
          interact: data
        })
      },

      changeInteract() {
        this.setState({
          interact: {
            type: ['0', '1', '2'][parseInt(3 * Math.random())]
          }
        })
      },

      render: function () {
        var windowList = hdata.testFun(30);
        windowList = _.map(windowList, (window) => {
          return {
            id: window.uuid.replace(/-/g, ''),
            title: window.name
          }
        })
        return (
          <div>
            <Form interact={this.state.interact}
              type='bar'
              dataSetting={ { } }
              windowList={ windowList }
              onChange={this.handleChange} />
            <hr/>
            <ValidateForm />
            <Button onClick={this.changeInteract.bind(this)}>切</Button>
          </div>
        );
      }
    });
  }

  App.prototype.init = function (elem) {
    ReactDOM.render(<this.AppView />, elem);
  };

  module.exports = App;

// });